<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="./js/react.js"></script>
    <script src="./js/react-dom.js"></script>
    <script src="./js/babel.min.js"></script>
    <title>Document</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      // 封装组件
      function Sku({ name, price }) {
        const goodClick = () => {
          console.log('你买不买')
        }

        return (
          <h4 onClick={goodClick}>
            商品名：{name}，价格：{price}
          </h4>
        )
      }

      const clickHandle = (event) => {
        console.log('clicked')
      }
      const appVnode = (
        <>
          <h3>事件处理</h3>
          <button onClick={clickHandle}>点我</button>
          <Sku name="iphone6" price="666" />
        </>
      )

      ReactDOM.createRoot(document.getElementById('root')).render(appVnode)
    </script>
  </body>
</html>
